package cn.bdqn.or.controller;

import cn.bdqn.or.pojo.Product;
import cn.bdqn.or.service.ProductService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping(value = "/product")
public class ProductController {
    @Resource
    private ProductService productService;
    @RequestMapping("/index")
    public String index(){
        return "index";
    }
    @RequestMapping("/home")
    public String home(){
        return "home";
    }
    @RequestMapping("/product")
    public String product(Model model) {
        List<Product> products = productService.selectProduct();
        System.out.println(model.addAttribute("products", products));
        return "Products_List";
    }
    @RequestMapping("/pictureadd")
    public String pictureAdd(){
        return "picture-add";
    }
}
